using System;
using System.Data;
using PersistenceObject.Framework.Expressions;
using System.Collections.Generic;

namespace PersistenceObject.Framework
{
    public interface IDataSession : IDisposable
    {
        IDbDriver DbDriver { get; set; }
        IDbConnection Connection { get; }
        IDbTransaction Transaction { get; }
        
        void BeginTran();
        void Open();
        void Close();
        IDelete CreateDelete(Table table);
        IInsert CreateInsert(Table table);
        IQuery CreateQuery(Table table);
        IUpdate CreateUpdate(Table table);
        int ExecuteNonQuery(IDbCommand comm);
        void Insert<T>(T t) where T : class;
        void Insert<T>(T t, Boolean isGetAutoID) where T : class;
        void Insert<T>(T t,Table table) where T : class;
        void Insert<T>(T t,Table table, Boolean isGetAutoID) where T : class;
        void Delete<T>(T t) where T : class;
        void Delete<T>(T t,Table table) where T : class;
        Int32 Update<T>(T t) where T : class;
        Int32 Update<T>(T t,Table table) where T : class;
        void Retrieve<T>(T t) where T : class;
        IDataReader ExecuteReader(IDbCommand comm);
        IDataReader ExecuteReader(IDbCommand comm, CommandBehavior commandBehavior);
        DataSet ExecuteDataSet(IDbCommand comm);
        object ExecuteScalar(IDbCommand comm);
        IList<T> List<T>(IExpression expression) where T : class;
        IList<T> List<T>() where T : class;
        void Commit();
        void RollBack();
        //void ExcuteCmds(params IDbCommand[] cmd);
        //DataSet ExecuteDataSet<T>(IExpression expression);
        //DataSet ExecuteDataSet<T>(string query, object[] values);
        //IList<T> List(IExpression expression, LoadInfo loadinfo);
        //IList<T> List<T>(string query, object[] values);
        //IList<T> List(string query, object[] values, LoadInfo loadinfo);
    }
}

